// API 通用响应类型
export interface ApiResponse<T = any> {
  success: boolean
  data?: T
  message: string
}

// 分页响应类型
export interface PaginatedResponse<T> {
  success: boolean
  data: {
    items: T[]
    total: number
    page: number
    pageSize: number
    totalPages: number
  }
  message: string
}

// 错误响应类型
export interface ApiError {
  success: false
  error: {
    code: string
    message: string
    details?: any
  }
}

// 选手相关类型
export interface PlayerSearchParams {
  page?: number
  pageSize?: number
  keyword?: string
  rank?: string
  position?: string
  sortBy?: 'createdAt' | 'updatedAt' | 'highestMmr' | 'nickname' | 'ability'
  sortOrder?: 'asc' | 'desc'
}

export interface CreatePlayerRequest {
  id: string
  nickname: string
  positions: string[]
  rank: string
  highestMmr: number
  ability: number
  tags: string[]
}

export interface UpdatePlayerRequest {
  id?: string
  nickname?: string
  positions?: string[]
  rank?: string
  highestMmr?: number
  ability?: number
  tags?: string[]
}

// 统计数据类型
export interface RankStatistic {
  rank: string
  count: number
  label: string
  color: string
}

export interface PositionStatistic {
  position: string
  count: number
  label: string
  percentage: number
}

export interface MmrStatistics {
  average: number
  highest: number
  lowest: number
  median: number
}

export interface PlayerStatistics {
  totalPlayers: number
  rankStatistics: RankStatistic[]
  positionStatistics: PositionStatistic[]
  mmrStatistics: MmrStatistics
}

export interface OverviewStatistics {
  players: {
    total: number
    activeThisMonth: number
    newThisMonth: number
  }
  matches: {
    total: number
    thisMonth: number
    upcoming: number
  }
  teams: {
    total: number
    active: number
  }
}
